<?php
/**
 * Created by PhpStorm.
 * Author: MeiJay
 * Date: 2020/2/23
 * Time: 12:39
 */

namespace App\Model;


use Encore\Admin\Auth\Database\Administrator;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;


class ImportJob extends Model
{
    public $table = 'import_job';

    protected $fillable = [
        'operator_id',
        'status',
        'type',
        'total',
        'has_handle_count',
        'success_count'
    ];


    /**
     * @desc 管理操作者账号
     *
     *
     * @return BelongsTo
     *
     * @author: 梅杰[meijie3169@dingtalk.com] at 2020-03-14 09:09:36
     */
    public function operator()
    {
        return $this->belongsTo(Administrator::class,'operator_id');
    }

    /**
     * @desc 关联错误
     *
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     *
     * @author: 梅杰[meijie3169@dingtalk.com] at 2020-03-14 10:35:07
     */
    public function failed()
    {
        return $this->hasMany(ImportJobFailed::class,'job_id');
    }

}
